# Contributor: Francesco Colis_ta <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=rutorrent
_pkgname=ruTorrent
pkgver=3.10
pkgrel=1
pkgdesc="Yet another web front-end for rTorrent"
url="https://github.com/Novik/ruTorrent"
arch="noarch"
license="GPL"
depends="php8 curl"
options="!check" # no test available
# we need to user gnu tar since the permissions on files in tar archive are
# bad
makedepends="tar"
pkggroups="rutorrent"
install="$pkgname.pre-install $pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/Novik/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	chmod -R u+w "$builddir"
}

package() {
	install -d $pkgdir/usr/share/webapps/$pkgname
	install -d $pkgdir/var/www/localhost/htdocs/
	cp -r * $pkgdir/usr/share/webapps/$pkgname
	chgrp -R rutorrent $pkgdir/usr/share/webapps/$pkgname/share
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/settings
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/torrents
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/users
}

sha512sums="
7d93c4fa2fab02878211b78b17d13a3f0822ccf8cd65b72518f5240513e214c392057d90efde7db61ef2788ad7040f7c34d6c5fa2594053f47d3f10b3c11ddc1  rutorrent-3.10.tar.gz
"
